const express = require('express');
const router = express.Router();

router.get('/statis', (req, res) => {
    res.json({
        message: '',
        payload: [{
            id: '1',
            code: 'code',
            name: 'name',
            total: 50,
            noSign: 100,
            noReply: 561
        }]
    });
});
router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 100; i++)
        content.push({
            id: `${i}`,
            code: `code${i}`,
            name: `name${i}`,
            status: 1,
            rowVersion: 'string',
            options: ['update', 'abandon']
        });
    res.json({
        message: '',
        payload: {
            content,
            totalElements: 100,
        }
    });
});

router.get('/:id', (req, res) => {
    const {id} = req.params;
    res.json(
        {
            message: 'string',
            payload: {
                id: '1',
                code: `code${id}`,
                name: `name${id}`,
                status: 1,
                rowVersion: 'A11111111',
                options: ['update', 'abandon'],
                details: [
                    {
                        responsiblerId: 'id1',
                        responsiblerName: 'responsiblerName1',
                    }
                ],
            }
        }
    );
});

router.post('/', (req, res) => {
    res.json(
        {
            message: '新增成功'
        }
    );
});

router.put('/:id', (req, res) => {
    res.json(
        {
            message: '修改成功'
        }
    );
});

router.put('/:id/abandon', (req, res) => {
    res.json({
        message: '作废成功'
    });
});

module.exports = router;
